Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(vest): Add AbortSignal as a parameter to test #1079

Merged
merged 5 commits into from
Sep 24, 2023

Conversation

ealush
Copy link
Owner

@ealush ealush commented Sep 24, 2023

Considering passing an AbortSignal to each of the tests in the suite, allowing consumers to abort their async operations once Vest cancels these tests.

Q A
Bug fix?
New feature?
Breaking change?
Deprecations?
Documentation?
Tests added?
Related issues Twit

Using AbortSignal

Since 5.1.0

Each test function is passed an object with a signal property. This signal is an AbortSignal which can be used to terminate your async operations once a test is canceled.

The AbortSignal has a boolean aborted property, by which you can determine whether the test was canceled or not.

A test gets canceled when running the same test again before its previous run has completed.

You can use the AbortSignal to stop the execution of your async test, or pass it to your fetch request.

More on AbortSignal.

test('name', 'Already Taken', async ({ signal }) => {
  // ...
});

@vercel
Copy link

vercel bot commented Sep 24, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
vest ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 24, 2023 11:18pm
vest-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 24, 2023 11:18pm

@ealush ealush changed the title add abort signal feat(vest): Add AbortSignal as a parameter to test Sep 24, 2023
@ealush ealush marked this pull request as ready for review September 24, 2023 23:50
@ealush ealush merged commit 2d28ea7 into latest Sep 24, 2023
github-actions bot pushed a commit that referenced this pull request Sep 25, 2023
650dfc9  Remove coverage workflow (Evyatar)
cbd27ad  vx: recover from missing stable branch (Evyatar)
828085b  minor(vest): Suite.subscribe for listening to state changes (Evyatar)
37a4031  minor(vest-utils): add suport for wildcard bus event (Evyatar)
89a843f  patch(vest): Suite dump runs on available root (Evyatar)
26b4a09  patch(n4s): downgrade validator (Evyatar)
2d28ea7  feat(vest): Add AbortSignal as a parameter to test (#1079) (Evyatar)
4260f59  types: fix vest.IsolateTest types in tests (Evyatar)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant